import { App } from 'vue'
import { getFloderFiles } from '@/utils/utils'
export default {
  install(app: App) {
    const files = require.context('.', true, /\.vue$/)
    getFloderFiles(files).forEach((item) => {
      if (item.resolveFilePath === 'index.ts') return
      const component = require(`@/globalComponents/${item.resolveFilePath}`).default
      if (typeof component === 'function') {
        component(app)
      } else {
        app.component(item.filename, component)
      }
    })
  }
}